package com.rg1906.web;

import java.io.IOException;
import java.sql.SQLException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.rg1906.service.impl.UpdateStudentMessageServiceImpl;


@WebServlet("/UpdateStudentMessage")
public class UpdateStudentMessage extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    
	UpdateStudentMessageServiceImpl service=new UpdateStudentMessageServiceImpl();
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String realname = request.getParameter("realname");
		String studentNum = request.getParameter("studentNum");
		String phone = request.getParameter("phone");
		String address = request.getParameter("address");
		String sex = request.getParameter("sex");
		String age = request.getParameter("age");
		String id=request.getParameter("id");
		try {
			int i = service.updateStudentMessage(id,realname,phone,address,sex,age);
			if(i>0) {
				response.getWriter().print(true);
			}else {
				response.getWriter().print(false);
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		doGet(request, response);
	}

}
